home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5152 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: lrz-muenchen.de!sun2!ua302aa
  2. From: ua302aa@sun2.lrz-muenchen.de (Kurt Watzka)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Newbie Q: Arrays > 64K?
  5. Date: 4 Feb 1996 22:51:59 GMT
  6. Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
  7. Distribution: world
  8. Message-ID: <4f3daf$46g@sparcserver.lrz-muenchen.de>
  9. References: <4f3ajc$oud@earth.superlink.net>
  10. NNTP-Posting-Host: sun2.lrz-muenchen.de
  11.  
  12. rizzom@superlink.net writes:
  13.  
  14. >Hi,
  15.  
  16. >  I am using Turbo C++ 3.0 in DOS.  I would just like to know 
  17. >how to declare an array that is larger than 64K.  I have tried 
  18. >all of the memory models available and still get an error 
  19.  
  20. You cannot portably have object with sizes greater than 32k in
  21. C. So obviously, your compiler does not have a problem when it
  22. gives you an error message for arrays larger than 64k.
  23.  
  24. You could
  25.  
  26.  1) Modify your data structure so that no object is larger than
  27.     32k (The size of one "VMProc" should be less than 2k on 
  28.     most machines, so an array of pointers to VMProc should 
  29.     be possible on most machines, working somehow like this:)
  30.  
  31.     VMProc *proc[64];
  32.  
  33.     for (i = 0; i < 64; i+= 16) {
  34.        VMProc *tmp = calloc(16, sizeof(VMProc));
  35.        if (tmp == NULL)
  36.       /* Handle error condition */
  37.        for (j = 0; j < 16, j++)
  38.       proc[i + j] = tmp + j;
  39.     }
  40.  
  41.     You have to check my assumption about the size of a VMProc
  42.     on your machine, using your implementation.
  43.  
  44.  2) Consider using an operating system that allows you to
  45.     use larger objects and forget about portability.
  46.  
  47. Kurt
  48. --
  49. | Kurt Watzka                             Phone : +49-89-2180-6254
  50. | watzka@stat.uni-muenchen.de
  51. | ua302aa@sunmail.lrz-muenchen.de
  52.  
  53.